import { check_type, plan_state, result } from '@/plugins/mate.js'
export const formConfig = [
    {
        name: 'scope_id_list',
        type: 'cascader',
        placeholder: '筛选范围',
        options: [],
    },
    {
        name: 'device_name',
        type: 'input',
        placeholder: '设备名称',
    },
    {
        name: 'cycle_id',
        type: 'select_id',
        placeholder: '巡检周期',
        options: [],
    },
    {
        name: 'type_id',
        type: 'select_id',
        placeholder: '巡检类型',
        options: check_type.options,
    },
    {
        name: 'plan_state',
        type: 'select',
        placeholder: '计划状态',
        options: plan_state.options,
    },
]

export const column = [
    {
        label: '设备名称',

        name: 'device_name',
    },

    {
        label: '巡检频率',
        name: 'cycle',
    },
    {
        label: '计划标题',
        name: 'title',
    },

    {
        label: '已执行次数',
        name: 'count',
    },
    {
        label: '起始时间',
        name: 'start_time',
    },
    {
        label: '截止时间',
        name: 'next_time',
    },
    {
        label: '巡检类型',
        name: 'type_id',
        format: (val) => check_type.dirc[val],
    },
    {
        label: '计划状态',
        name: 'plan_state',
        format: (val) => plan_state.dirc[val],
        color: (val) => (val === 1 ? '#4dab72' : val === 2 ? '#878a8d' : '#fbc21b'),
    },
    {
        title: '操作',
        name: 'action',
        width: '260',
        buttons: [],
    },
]
//单次计划配置
export const config0 = [
    {
        name: 'device',
        type: 'device',
        placeholder: '请选择设备',
        label: '执行设备',
        required: true,
    },
    {
        name: 'title',
        type: 'input',
        placeholder: '计划标题',
        label: '计划标题',
        required: true,
    },
    {
        name: 'plan_state',
        type: 'select',
        label: '计划状态',
        placeholder: '计划状态',
        options: plan_state.options.slice(1, plan_state.options.length - 1),
        required: true,
    },
    {
        name: 'content',
        type: 'input',
        label: '内容详情',
        placeholder: '请输入计划内容',
    },
    {
        name: 'next_time',
        type: 'date',
        label: '结束时间',
        placeholder: '请设置结束时间',
        required: true,
    },
]
// 周期计划配置
export const config1 = [
    {
        name: 'device',
        type: 'device',
        placeholder: '请选择设备',
        label: '执行设备',
        required: true,
    },
    {
        name: 'title',
        type: 'input',
        placeholder: '计划标题',
        label: '计划标题',
        required: true,
    },

    {
        name: 'cycle_id',
        type: 'select_id',
        label: '巡检频率',
        placeholder: '巡检频率',
        options: [],
        required: true,
    },
    {
        name: 'plan_state',
        type: 'select',
        label: '计划状态',
        placeholder: '计划状态',
        options: plan_state.options.slice(1, plan_state.options.length - 1),
        required: true,
    },

    {
        name: 'content',
        type: 'input',
        label: '内容详情',
        placeholder: '请输入计划内容',
    },
    {
        name: 'start_time',
        type: 'date',
        label: '起始时间',
        placeholder: '请设置起始时间',
        required: true,
    },
    {
        name: 'count',
        type: 'number',
        label: '执行次数',
        placeholder: '请设置已执行次数',
        required: true,
        min: 0,
    },
]

export const config2 = [
    {
        name: 'title',
        type: 'input',
        label: '所属计划',
        disable: (val) => true,
        required: true,
    },
    {
        name: 'reporter',
        type: 'input',
        label: '填报人',
        required: true,
    },
    {
        name: 'details',
        type: 'input',
        label: '巡检详情',
    },
    {
        name: 'photo',
        type: 'image',
        label: '现场照片',
    },
    {
        name: 'create_time',
        type: 'date',
        label: '巡检时间',
        required: true,
    },
    {
        name: 'result',
        type: 'select',
        label: '巡检结果',
        options: result.options.slice(1, result.options.length),
        required: true,
    },
]
